From: Chad Horohoe Date: Mon, 15 Oct 2012 15:16:37 +0000 (-0400) Subject: Move cache purging out of doUpdates() X-Git-Tag: 1.31.0-rc.0~21851^2 X-Git-Url: http://git.cyclocoop.org//%22http:/%22.attribut_html%28%24lesurls%5B%24numero%5D%29.%22/%22?a=commitdiff_plain;h=ee01bb0d9496855aa6581d1dd909c7d08bd56903;p=lhc%2Fweb%2Fwiklou.git Move cache purging out of doUpdates() It makes a whole lot more sense to run this at the end of the update process after post update maintenance rather than just at the end of schema updates. Run update.php more than once so all the updatelog entries are populated and you'll see why it makes sense. Change-Id: Ice42a31dee1e6b41da4aa0a47e8786579382aff1 --- diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index de59b2d65f..75ede239b3 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -269,14 +269,15 @@ abstract class DatabaseInstaller { $ret = true; ob_start( array( $this, 'outputHandler' ) ); + $up = DatabaseUpdater::newForDB( $this->db ); try { - $up = DatabaseUpdater::newForDB( $this->db ); $up->doUpdates(); } catch ( MWException $e ) { echo "\nAn error occurred:\n"; echo $e->getText(); $ret = false; } + $up->purgeCache(); ob_end_flush(); return $ret; } diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 7223003180..740ead528d 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -292,8 +292,8 @@ abstract class DatabaseUpdater { * * @param $what Array: what updates to perform */ - public function doUpdates( $what = array( 'core', 'extensions', 'purge', 'stats' ) ) { - global $wgLocalisationCacheConf, $wgVersion; + public function doUpdates( $what = array( 'core', 'extensions', 'stats' ) ) { + global $wgVersion; $this->db->begin( __METHOD__ ); $what = array_flip( $what ); @@ -310,14 +310,6 @@ abstract class DatabaseUpdater { if ( isset( $what['stats'] ) ) { $this->checkStats(); } - - if ( isset( $what['purge'] ) ) { - $this->purgeCache(); - - if ( $wgLocalisationCacheConf['manualRecache'] ) { - $this->rebuildLocalisationCache(); - } - } $this->db->commit( __METHOD__ ); } @@ -617,11 +609,15 @@ abstract class DatabaseUpdater { /** * Purge the objectcache table */ - protected function purgeCache() { + public function purgeCache() { + global $wgLocalisationCacheConf; # We can't guarantee that the user will be able to use TRUNCATE, # but we know that DELETE is available to us $this->output( "Purging caches..." ); $this->db->delete( 'objectcache', '*', __METHOD__ ); + if ( $wgLocalisationCacheConf['manualRecache'] ) { + $this->rebuildLocalisationCache(); + } $this->output( "done.\n" ); } diff --git a/maintenance/update.php b/maintenance/update.php index e3c993badc..cb6f06b2c2 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -118,9 +118,6 @@ class UpdateMediaWiki extends Maintenance { $shared = $this->hasOption( 'doshared' ); $updates = array( 'core', 'extensions', 'stats' ); - if( !$this->hasOption('nopurge') ) { - $updates[] = 'purge'; - } $updater = DatabaseUpdater::newForDb( $db, $shared, $this ); $updater->doUpdates( $updates ); @@ -140,6 +137,10 @@ class UpdateMediaWiki extends Maintenance { } } + if( !$this->hasOption('nopurge') ) { + $updater->purgeCache(); + } + $this->output( "\nDone.\n" ); }